package org.liulinlin.sejw.db;

import java.sql.*;

public class DeclareComit {
	private String id;
	private Commission commission;
	private String hs;
	private double totalValue;
	private Date exportDate;
	private String exportDateString;
	private BLInfo blInfo;
	private String way;
	private String originPlace;
	private String otherRequest;
	private String commited;
	private Date receiveDate;
	private String receiveDateString;
	private int receiveStatus;
	private String receiveOther;
	private double fee;
	
	public DeclareComit() {
		
	}
	public DeclareComit(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("DeclareComit不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from DeclareComit where DC_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			commission = new Commission(rs.getString("Comm_ID"));
			hs = rs.getString("DC_HS");
			totalValue = rs.getDouble("DC_TotalValue");
			exportDate = rs.getDate("DC_ExportDate");
			if (exportDate != null) {
				exportDateString = exportDate.toString();
			}
			blInfo = new BLInfo(rs.getString("BL_ID"));
			way = rs.getString("DC_Way");
			originPlace = rs.getString("DC_OriginPlace");
			otherRequest = rs.getString("DC_OtherRequest");
			commited = rs.getString("DC_Commited");
			receiveDate = rs.getDate("DC_ReceiveDate");
			if (receiveDate != null) {
				receiveDateString = receiveDate.toString();
			}
			receiveStatus = rs.getInt("DC_ReceiveStatus");
			receiveOther = rs.getString("DC_ReceiveOther");
			fee = rs.getDouble("DC_Fee");
			
			stmt.close();
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setCommission(Commission commission) {
		this.commission = commission;
	}
	public void setHs(String hs) {
		this.hs = hs;
	}
	public void setTotalValue(double totalValue) {
		this.totalValue = totalValue;
	}
	public void setExportDate(Date exportDate) {
		this.exportDate = exportDate;
	}
	public void setExportDateString(String exportDateString) {
		this.exportDateString = exportDateString;
	}
	public void setBLInfo(BLInfo blInfo) {
		this.blInfo = blInfo;
	}
	public void setWay(String way) {
		this.way = way;
	}
	public void setOriginPlace(String originPlace) {
		this.originPlace = originPlace;
	}
	public void setOtherRequest(String otherRequest) {
		this.otherRequest = otherRequest;
	}
	public void setCommited(String commited) {
		this.commited = commited;
	}
	public void setReceiveDate(Date receiveDate) {
		this.receiveDate = receiveDate;
	}
	public void setReceiveDateString(String receiveDateString) {
		this.receiveDateString = receiveDateString;
	}
	public void setReceiveStatus(int receiveStatus) {
		this.receiveStatus = receiveStatus;
	}
	public void setReceiveOther(String receiveOther) {
		this.receiveOther = receiveOther;
	}
	public void setFee(double fee) {
		this.fee = fee;
	}
	
	public String getId() {
		return id;
	}
	public Commission getCommission() {
		return commission;
	}
	public String getHs() {
		return hs;
	}
	public double getTotalValue() {
		return totalValue;
	}
	public Date getExportDate() {
		return exportDate;
	}
	public String getExportDateString() {
		return exportDateString;
	}
	public BLInfo getBLInfo() {
		return blInfo;
	}
	public String getWay() {
		return way;
	}
	public String getOriginPlace() {
		return originPlace;
	}
	public String getOtherRequest() {
		return otherRequest;
	}
	public String getCommited() {
		return commited;
	}
	public Date getReceiveDate() {
		return receiveDate;
	}
	public String getReceiveDateString() {
		return receiveDateString;
	}
	public int getReceiveStatus() {
		return receiveStatus;
	}
	public String getReceiveOther() {
		return receiveOther;
	}
	public double getFee() {
		return fee;
	}
}
